/**
 * 
 */
package com.kaba.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.UUID;

/**
 * @author pvz77
 *
 */
public class RenameFile {

	public static String rename (String fileName) {
		fileName = fileName.substring(fileName.lastIndexOf("."), fileName.length());
		return new SimpleDateFormat("yyyyMMddHHmmssSSS").format(Calendar.getInstance().getTime()) + fileName;
	}
	
	public static String updateFileName(String fileName) {
		fileName = "." + RenameFile.getSuffix(fileName);
		return UUID.randomUUID().toString().toUpperCase().replaceAll("-", "") + fileName;
	}
	
	public static String getSuffix (String fileName) {
		return fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
	}
	
	public static String getPrefix (String fileName) {
		return fileName.substring(0, fileName.lastIndexOf("."));
	}
}
